//
//  STReduceCell.m
//  YiYueHairdresser
//
//  Created by zhouzhouzhou on 2018/10/10.
//  Copyright © 2018年 YuYiLian. All rights reserved.
//

#import "STReduceCell.h"
#import "SWCouponModel.h"

@interface STReduceCell()
@property(nonatomic, strong) NSArray <NSString *>*titleArray;
@end
@implementation STReduceCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.reduceDownBtn.layer.masksToBounds = YES;
    self.reduceDownBtn.layer.cornerRadius = 3;
    
    self.mainView.layer.masksToBounds = YES;
    self.mainView.layer.cornerRadius = 5;
    
}

- (IBAction)actionReduceDown:(UIButton *)sender {
     self.clickBlockAction(self.model, sender);
}

-(void)setModel:(SWCouponModel *)model {
    _model = model;
    _discountLabel.text = model.deduction;
    _termLab.text = [NSString stringWithFormat:@"优惠时间：%@",model.usestart];
    _timeLab.text = [NSString stringWithFormat:@"有效时间：%@",model.validstart];
    _termLab.text = [NSString stringWithFormat:@"领取时间：%@",model.receivestart];
    [_reduceDownBtn setTitle:self.titleArray[model.status] forState:UIControlStateNormal];
}

-(NSArray<NSString *> *)titleArray {
    if (_titleArray == nil) {
        
        _titleArray = @[@"上架",@"下架"];
    }
    return _titleArray;
}
@end
